#include <vector>
#include <memory>
#include <sys/types.h>
#include <sys/socket.h>
#include <thread>
#include <map>
#include <iostream>
#include <unistd.h>
#include <sstream>
#include <regex>
#include "Server/include/Request.hpp"
#include "Server/include/Server.hpp"
#include "url/include/url.hpp"
#include <sys/stat.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/epoll.h>
// #include "Server/include/File.hpp"
#include <memory>
#include <signal.h>
// #include "media/include/media.hpp"
#include "url/include/setting_url.hpp"
#include "Server/include/httpRequest.hpp"
#include "_debug/include/debug_setting.h"
// #include "threadPool/include/task.hpp"
// #include "Server/include/File.hpp"
// #include "threadPool/src/ttask.cpp"
#include "threadPool/include/pool.hpp"
#include <unistd.h>


void handle_SIGPIPE(int signum){
	printf("recv signal num %d...\n",signum);
}

void* f(void* arg){
	
	_Task s=*static_cast<_Task*>(arg);
	for(int i=0;i<50;i++){
		std::cout<<(*(int*)s.data)<<" ";
	}
	printf("me...\n");
	return nullptr;
}

// template class FunT<int>;

int main(int arg,char** argv){
	if(signal(SIGPIPE,handle_SIGPIPE)==SIG_ERR){
		printf("信号注册失败\n");
		return -1;
	}
	Pool pool(5);
	for(int i=1;i<=8;i++){
		// std::vector<int> boxs(10,i);
		pool.addTasks(new _Task(f,(void*)std::move(&i)));
		// usleep(0.1);
		printf("end\n");
		// f((void*)std::move(&i));
	}

    // printf("%d\n",getpid());
	// std::cout<<"当前端口:"<<std::atoi(argv[1])<<std::endl;
    // Server s(std::atoi(argv[1]));
    // configuration();
    // s.run();

    return 0;
}

// 175944 

